package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102800774352";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCSpGbWkzOiNC8lMV3KDmkTYv3Ydb2Wm3Yorvt/IzHRf3DsCrZlsWKsaofhaYlOSs6TFHICXE4isjIFdTNdM0zmhtLxPo+f5/lyjBzjb0+DQ8zYqeuSfPmrQ5iX7t66+EE+pEfF00gWGhh4bqt4uya47qZBJ1PBLcs7H0hBGs8DVNSgMalVXKW2Qp4WVP9pXcMOi49cZ2lujKkGzzpQM7TKjO9cKOc1uCT/cdwEZqQDg0eav6ye/LIMZS4vz3xtCpQ5LFiUhOFBYgcKIK4GioNyPpBx/y3ebhpFVw4P9iIzOG5EE00ux1fLv5deRKQyVKHSgvK2+97pp4bmhcs8GC6ZAgMBAAECggEAO2S7Ak28rAXW0omcIyqTBHcjuXh2wXlV8kRtOKFYnDGx2ui715RxEsRTJMlKA5vo70loo+we+Y6TFALUOvt8OiKBbZSZN3sNXYfCa5u56MCdR2QLNdnIhcVrGJ53N+M1Cdof99ALcmg/YQfyC4RBusVuMRVspuGVXuzcpwHktsQXOQ1l77IWbL17vjqsbkPWPIcBokMvyS7QxQY71eYmQtGVwA16GbXQwXwXOnm/M0HmOlFHkGbSe2u2E10RyvtGeNBNeX38AtLSGAVFkQbdzRMVx1YDP6EgV/JCpqFDvhGtLPnZov2JA3HUK/50LFSFA8BxFkyoC3hNYpYH3JwkwQKBgQDYA7aCK5qD8TCcqceU3dQIIe/FdiDdwjuksTFSjsgkLTQLDf5s1UHmsgdlT0Qfe2/gFXlKqNYjAjw4GbcTlLMYzg8lh0Ri5QaFcWTk3MDSjJfHSmFYleWKsN0L0GhSyyN9ly4/l20LTEy8XZ19xu+5LJ9VbJw8AUD2IERE4f3I+wKBgQCtyVc1Yz0OzQ6HaAP6Ro8WbSzbjkXBGW1QX0VSusQFfrfdMPhiPDMsBgA26g2/MrtbNlmnOv0FhysbcC6Ul2fTLmeroKlfBzCPiMTCUBdR9WHvobdYs22OkQ6BxtiM58xOWrvxYgvyrhmXSBKz0U8jXDsPuTCWfBJhmtyo5FN6ewKBgGdOL0RFchnTiPoDQA1zoOlawX5fpgwnzbpPe1UOL60NaSw4PwrxWhjn3x2WMPAVakVyP5Vy9SW89eumcKWOobAlK504+X2KJfo/Zo8E+7o1vohyi+d/mE0hlDUIMDwYJhrz6AxFcMLMdI5I/v6d2xtlubVywaz4tIaAm+WNZn9tAoGAK7lxqKwMS7IKCsV/4rNoAuN7Gs6D/F6SY1tlDLiS4zMLvao5hDXTRitIWIiw5r8z5nIZQnsT+BUXInMqNRaW98pAKS1mD9O2QxbNMnqGM4fCmVEd2UJjuTAD72EBUQptG/W2PbhGe0uUgryOgBGUkLf+4Cje8a3LziTxicjQvAsCgYAlRPlF3kclbXOcB22rEKkQ4JAQ+ntRfcHeQgFbb8j6sIBQ0Q41dIBIXTOir83X0lXNEgdmUWnVQ4SqASFxTLD7VzaRMp6hZYekzUYRU2npu6YU/66jyde8LGMEfG6dAS3+JRuMnzWCbvr1Fr5I2ArUa7peVI2ts2pX5HcnGSSYHg==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkiQfpmtfVbTJVo2JCK6wv6z7c+lwS6VP/OwlRWmy4qO8zZFFwwKzd84jZAq0cwVonWzSW9bQqL47fCX3Ue70GPIJuIE3M9dDiKxzrXAYqxB3/7CPzqwXjn7B7tZ4I+Vv/2HBJgfxMRGhC6Lk2N4xf9E9K+/Bl/Fy4ovQQ+yG0uzdQHdK5ybS3H2ajkQnUViGBaJ1BP+hQb/RDygo4LgLutwRE1QrzM5wmeFNE6TSZh2+/oENOLJf7AOnlu5PxL+Irsb0y29Zti3l16o0bkU2HMOt3jQ/3soyTy2wU/RnidnSBs6Su5Y28iSv3obe+BoDoUwpcA00Jh75OSHAoYXbtwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8089/llpay/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8089/llpay/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

